using System;
using System.Data.SqlTypes;
using System.Data.Common;
using System.Data.SqlClient;
using System.Data;

namespace FrameworkX.ObjectSpace.Data.Schema
{
	/// <summary>
	/// Property map class. Maps property to database colums
	/// </summary>
	public class PropertyMap
	{
		public PropertyMap()
		{
		}

		/// <summary>
		/// Property map 
		/// </summary>
		/// <param name="property">Property to map by</param>
		/// <param name="schemaRow">Datatable schema row</param>
		public PropertyMap(System.Reflection.PropertyInfo property, DataRow schemaRow )
		{
			this.Property = property;
			this.SchemaRow = schemaRow;
		}

		private System.Reflection.PropertyInfo _property ;
		private DataRow _schemaRow;
		private int _columnOrdinal = -1;
		private string _columnName = "";
		private string _columnNameAlias = "";

		/// <summary>
		/// Property 
		/// </summary>
		public System.Reflection.PropertyInfo Property
		{
			get
			{
				return _property;
			}
			set 
			{
				_property = value;
			}
		}

		/// <summary>
		/// The datatable row fetched for schema. No need to
		/// store. Have to get rid of this
		/// </summary>
		public DataRow SchemaRow
		{
			get
			{
				return _schemaRow;
			}
			set 
			{
				_schemaRow = value;
			}
		}
	
		/// <summary>
		/// Ordinal of the column
		/// </summary>
		public int ColumnOrdinal
		{
			get
			{
				return _columnOrdinal;
			}
			set
			{
				_columnOrdinal = value;
			}
		}

		/// <summary>
		/// Ordinal of the column name
		/// </summary>
		public string ColumnName
		{
			get
			{
				return _columnName;
			}
			set
			{
				_columnName = value;
			}
		}

		/// <summary>
		/// Alias for the column name
		/// </summary>
		public string ColumnNameAlias
		{
			get
			{
				return _columnNameAlias;
			}
			set
			{
				_columnNameAlias = value;
			}
		}

		private bool _isIdentity;
		
		/// <summary>
		/// Property IsIdentity (bool)
		/// </summary>
		public bool IsIdentity
		{
			get { return _isIdentity; }
			set { _isIdentity = value; }
		}

        private bool _isEncrypted = false;

        /// <summary>
        /// Property IsIdentity (bool)
        /// </summary>
        public bool IsEncrypted
        {
            get { return _isEncrypted; }
            set { _isEncrypted = value; }
        }

        private bool _useEncryptionKeyFromConfig = false;

        /// <summary>
        /// Property IsIdentity (bool)
        /// </summary>
        public bool UseEncryptionKeyFromConfig
        {
            get { return _useEncryptionKeyFromConfig; }
            set { _useEncryptionKeyFromConfig = value; }
        }

        private string _encryptionKey = string.Empty;

        public string EncrtyptionKey
        {
            get { return _encryptionKey; }
            set { _encryptionKey = value; }
        }
        
		

	}
}
